package com.zs.conterllor;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("exception")
public class ExceptionHandlerDemo {

	@RequestMapping("testExceptionHandler")
	public String testExceptionHandler() {
		System.out.println(1/0);
		return "success";
	}
	
	@ExceptionHandler({ArithmeticException.class})
	public String handlerArithmticException(ArithmeticException e) {
		System.out.println(e);
		return "error";
	}
}
